home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
626-650
/
634
/
apig
/
apig33.lzh
/
bitmapscale.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-02-19
|
2KB
|
84 lines
/* Example of loading iff pic into custom screen */
/* then then Scale a BitMap */
/* */
x = addlib("apig.library",0,-30,0)
call set_apig_globals()
scr = 0
picture = loadiff("gorilla")
if picture = '0000 0000'x then
do
say "I could not find that picture"
exit
end
width = iffwidth(picture)
height = iffheight(picture)
depth = iffdepth(picture)
viewmode = iffviewmode(picture)
ncolors = iffcolors(picture)
colors = iffcolortab(picture)
say "Width = " width
say "Depth = " depth
say "Height = " height
say "Viewmode = " viewmode
say "Numcolors = " ncolors
say "ColorTab = " d2x(c2d(colors))
scr = openscreen(0,0,width,height,depth,1,0,viemode,CUSTOMSCREEN,0)
scrrp = getscreenrastport(scr)
z = useiffcolor(picture,scr)
/* the following blit copies the IFF image into the screens rastport */
z = bltbitmaprastport(picture,0,0,scrrp,0,0,width,height,c2d('00c0'x))
wait 2 sec
bmwidth = width / 2
bmheight = height / 2
scalewidth = width / 2
scaleheight = height / 2
mybitmap = makebitmap(bmwidth,bmheight,depth)
bms = ALLOCVEC(48,MEMF_CLEAR)
call SETVALUE(bms,0,2,'n',0) /* src X */
call SETVALUE(bms,2,2,'n',0) /* src Y */
call SETVALUE(bms,4,2,'n',width) /* src width */
call SETVALUE(bms,6,2,'n',height) /* src height */
call SETVALUE(bms,8,2,'n',width) /* Xfactor */
call SETVALUE(bms,10,2,'n',height) /* Yfactor */
call SETVALUE(bms,12,2,'n',0) /* dest X */
call SETVALUE(bms,14,2,'n',0) /* dest Y */
call SETVALUE(bms,16,2,'n',bmwidth) /* dest width */
call SETVALUE(bms,18,2,'n',bmheight) /* dest height */
call SETVALUE(bms,20,2,'n',scalewidth) /* Xfactor */
call SETVALUE(bms,22,2,'n',scaleheight) /* Yfactor */
call SETVALUE(bms,24,4,'p',picture) /* source bitmap */
call SETVALUE(bms,28,4,'p',mybitmap) /* destination bitmap */
/* scale it into mybitmap */
call BITMAPSCALE(bms)
/* blit mybitmap into screen */
z = bltbitmaprastport(mybitmap,0,0,scrrp,0,0,bmwidth,bmheight,c2d('00c0'x))
wait 15 sec
call FREEBITMAP(picture)
call FREEBITMAP(mybitmap)
call FREEVEC(bms)
call CLOSESCREEN(scr)
exit